var express = require('express');
var router = express.Router();

router.post('/list', function (req, res, next) {
  const { offset = 0, size = 10 } = req.body;
  const goods = [];

  for (let i = offset; i < offset + size; i++) {
    goods.push({
      id: i + 1,
      name: `商品${i + 1}`,
      oldPrice: 100.0 + i, // 示例价格
      newPrice: 80.0 + i, // 示例价格
      desc: `这是商品${i + 1}的描述`,
      status: '在售',
      imgUrl: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
      inventoryCount: 100 + i,
      saleCount: 50 + i,
      faverCount: 20 + i,
      address: '中国',
      categoryId: 1,
      createAt: new Date().toISOString(),
      updateAt: new Date().toISOString(),
    });
  }
  res.send({ code: 0, data: { list: goods, total: goods.length * 10 } });
});
module.exports = router;
